package lab.poc.erl;

public class MatchOrAfter<R> {

	public final Match match;
	public final R result;

	public MatchOrAfter(final Match m) {
		this.match = m;
		this.result = null;
	}

	public MatchOrAfter(final R resultOfAfterExpr) {
		this.result = resultOfAfterExpr;
		this.match = null;
	}

	MatchOrAfter(final Match m, final R resultOfAfterExpr) {
		if (m == null && resultOfAfterExpr == null) {
			throw new IllegalArgumentException("both constructor arguments are null");
		}
		this.match = m;
		this.result = resultOfAfterExpr;
	}

	public final boolean isMatch() {
		return match != null;
	}

	public final boolean isResult() {
		return !isMatch();
	}
}
